#!/usr/bin/env bash

echo "start test.sh"
echo -e "\n"
echo `who`
echo -e "\n"
echo `w`
echo -e "\n"
echo `pwd`
echo -e "\n"

export ANDROID_HOME=../../Sdk
export ANDROID_NDK_HOME=../../ndk

apk="../Mysub/mylibrary/build/intermediates/bundles/default/classes.jar"
mkdir -p app/libs
cp $apk app/libs/Mysub.jar

./gradlew :app:build
erro=$?
echo "gradlew return $erro "

echo `pwd`
echo -e "\n"

apk="app/build/outputs/apk/app-debug.apk"
#erro=0

if [ -f "$apk" ];then
    echo -e "\n$apk ok"
else
    echo -e "\n$apk filed"
    erro=-1
fi


echo "stop test.sh"
exit $erro